import api from '@/services/merchant-account/merchant-user/withdrawal';

export type MerchantAccountMerchantUserWithdrawalList =
  MerchantAccountMerchantUserWithdrawalApi.ListResponse;
export const getFilterList = async () => {
  const res = await api.getFilterList();
  return res.data;
};
export const getList = async (params: MerchantAccountMerchantUserWithdrawalApi.ListParams) => {
  const res = await api.getList<MerchantAccountMerchantUserWithdrawalList>(params);
  const tableData: Requestor.TableFormatedData<MerchantAccountMerchantUserWithdrawalList> = {
    data: res.listData,
    current: res.page + 1,
    pageSize: res.limit,
    total: res.count,
    success: res.success,
  };

  return tableData;
};
export const updateWithdrawal = async (
  params: MerchantAccountMerchantUserWithdrawalApi.WithdrawalParams,
) => {
  const data = await api.updateWithdrawal(params);
  return data;
};
export default {
  getFilterList,
  getList,
  updateWithdrawal,
};
